#!/bin/bash

echo "测试SPI服务接口..."

# 测试健康检查
echo "1. 测试健康检查接口..."
curl -s http://localhost:8080/health | jq .

echo -e "\n2. 测试token获取接口..."
curl -s http://localhost:8080/test/token | jq .

echo -e "\n3. 测试SPI token接口..."
curl -s http://localhost:8080/api/v1/spi/token | jq .

echo -e "\n4. 测试同步状态接口..."
curl -s http://localhost:8080/api/v1/sync/status | jq .

echo -e "\n5. 测试SSO认证URL生成..."
curl -s http://localhost:8080/api/v1/sso/auth | jq .

echo -e "\n6. 测试根据ticket获取token..."
curl -X POST http://localhost:8080/api/v1/sso/checkTicket \
  -H "Content-Type: application/json" \
  -d '{"ticket":"test_ticket_123"}' | jq .

echo -e "\n7. 测试根据token获取用户信息..."
curl -s "http://localhost:8080/api/v1/sso/userinfo?accessToken=test_access_token" | jq .

echo -e "\n测试完成！"

